<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <!--meta:vp-->
    <!--只在移动端识别-->
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/>
    <title>首页</title>
    <link rel="stylesheet" href="css/base.css"/>
    <link rel="stylesheet" href="css/index.css"/>
</head>
<body>
    <!--主体布局容器-->
    <div class="jd_layout">
        <!--头部 start-->
        <header class="jd_header">
            <div class="jd_header_box">
                <a href="#" class="icon_logo"></a>
                <!--在移动端点击弹出输入法  enter键会显示搜索-->
                <form action="#">
                    <span class="icon_search"></span>
                    <input type="search" placeholder="提示"/>
                </form>
                <a href="#" class="login">登录</a>
            </div>
        </header>
        <!--头部 end-->
        <!--轮播图 start-->
        <div class="jd_banner">
            <ul class="clearfix">
                <li><a href="#"><img src="images/l8.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l1.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l2.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l3.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l4.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l5.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l6.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l7.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l8.jpg" alt=""/></a></li>
                <li><a href="#"><img src="images/l1.jpg" alt=""/></a></li>
            </ul>
            <ul>
                <li class="now"></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
        <!--轮播图 end-->
        <!--导航栏 start-->
        <nav class="jd_nav">
            <ul class="clearfix">
                <li><a href=""><img src="images/nav0.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav1.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav2.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav3.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav4.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav5.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav6.png" alt=""/><p>分类查询</p></a></li>
                <li><a href=""><img src="images/nav7.png" alt=""/><p>分类查询</p></a></li>
            </ul>
        </nav>
        <!--导航栏 end-->
        <!--主体 start-->
        <main class="jd_main">
            <!--掌上秒杀-->
            <section class="jd_product">
                <div class="jd_product_tit no_border clearfix">
                    <div class="f_left">
                        <span class="sk_icon"></span>
                        <span class="sk_name">掌上秒杀</span>
                        <div class="sk_time">
                            <span>0</span>
                            <span>0</span>
                            <span>:</span>
                            <span>0</span>
                            <span>0</span>
                            <span>:</span>
                            <span>0</span>
                            <span>0</span>
                        </div>
                    </div>
                    <div class="f_right">
                        <a class="sk_more" href="#">更多></a>
                    </div>
                </div>
                <div class="jd_product_con">
                    <ul class="sk_product clearfix">
                        <li>
                            <a href="#"><img src="images/detail01.jpg" alt=""/></a>
                            <p class="sk_price">&yen;10.00</p>
                            <p class="sk_price">&yen;10.00</p>
                        </li>
                        <li>
                            <a href="#"><img src="images/detail02.jpg" alt=""/></a>
                            <p class="sk_price">&yen;10.00</p>
                            <p class="sk_price">&yen;10.00</p>
                        </li>
                        <li>
                            <a href="#"><img src="images/detail01.jpg" alt=""/></a>
                            <p class="sk_price">&yen;10.00</p>
                            <p class="sk_price">&yen;10.00</p>
                        </li>
                    </ul>
                </div>
            </section>
            <section class="jd_product">
                <div class="jd_product_tit">
                    <h3>京东超市</h3>
                </div>
                <div class="jd_product_con clearfix">
                    <a class="w_50 f_left b_right" href="#"><img src="images/cp1.jpg" alt=""/></a>
                    <a class="w_50 f_right b_bottom" href="#"><img src="images/cp2.jpg" alt=""/></a>
                    <a class="w_50 f_right" href="#"><img src="images/cp3.jpg" alt=""/></a>
                </div>
            </section>
            <section class="jd_product">
                <div class="jd_product_tit">
                    <h3>京东超市</h3>
                </div>
                <div class="jd_product_con clearfix">
                    <a class="w_50 f_right b_left" href="#"><img src="images/cp4.jpg" alt=""/></a>
                    <a class="w_50 f_left b_bottom" href="#"><img src="images/cp5.jpg" alt=""/></a>
                    <a class="w_50 f_left" href="#"><img src="images/cp6.jpg" alt=""/></a>
                </div>
            </section>
            <section class="jd_product">
                <div class="jd_product_tit">
                    <h3>京东超市</h3>
                </div>
                <div class="jd_product_con clearfix">
                    <a class="w_50 f_left b_right" href="#"><img src="images/cp1.jpg" alt=""/></a>
                    <a class="w_50 f_right b_bottom" href="#"><img src="images/cp2.jpg" alt=""/></a>
                    <a class="w_50 f_right" href="#"><img src="images/cp3.jpg" alt=""/></a>
                </div>
            </section>
        </main>
        <!--主体 end-->
    </div>
    <script src="js/zepto/zepto.min.js"></script>
    <!--引入selector-->
    <script src="js/zepto/selector.js"></script>
    <!--引入fx-->
    <script src="js/zepto/fx.js"></script>
    <!--touch-->
    <script src="js/zepto/touch.js"></script>
    <script>
        /*页面加载完成执行*/
        $(function(){
            /*获取到banner*/
            var $banner = $('.jd_banner');
            /*图片盒子*/
            var $imageBox = $banner.find('ul:eq(0)');
            /*点盒子*/
            var $pointBox = $banner.find('ul:eq(1)');

            /*宽度*/
            var width = $banner.width();

            var animateFuc = function(callback){
                /*动画*/
                $imageBox.animate({'transform':'translateX(-'+index*width+'px)'},200,'ease',function(){
                    if(index >= 9){
                        index = 1;
                        $imageBox.css({'transform':'translateX(-'+index*width+'px)'});
                    }else if(index <= 0){
                        index = 8;
                        $imageBox.css({'transform':'translateX(-'+index*width+'px)'});
                    }
                    $pointBox.find('li').removeClass('now').eq(index-1).addClass('now');
                    /*动画结束 加定时器*/
                    callback &&callback();
                });
            }

            /*索引*/
            var index = 1;
            var timer = setInterval(function(){
                index ++;
                /*动画*/
                animateFuc();
            },2000);

            /*绑定左滑事件*/
            $imageBox.on('swipeLeft',function(){
                clearInterval(timer);
                index ++;
                animateFuc(function(){
                    /*动画结束*/
                    timer = setInterval(function(){
                        index ++;
                        /*动画*/
                        animateFuc();
                    },2000);
                });
            });
            /*绑定右滑事件*/
            $imageBox.on('swipeRight',function(){
                clearInterval(timer);
                index --;
                animateFuc(function(){
                    /*动画结束*/
                    timer = setInterval(function(){
                        index ++;
                        /*动画*/
                        animateFuc();
                    },2000);
                });
            });



        });
    </script>
</body>
</html>